    m1 = 1;
    n2 = n1 +1;
    m2 = 1;

    % 计算新的 surrogate function
    delta_2f =  - 2 * pi / lambda * ( ...
            cos_func(y_cur(n1),m1,y_cur(n2),m2) ...
               * ( (y_cur(n1) - r_u(2))/norm(r_u - [0,y_cur(n1)].') - (y_cur(n1) - r_w(2))/norm(r_w - [0,y_cur(n1)].')...
               )^2 ...
             + sin_func(y_cur(n1),m1,y_cur(n2),m2) * ...
             (- (r_u(1)^2)/norm(r_u - [0,y_cur(n1)].')^3 + (r_w(1)^2)/norm(r_w - [0,y_cur(n1)].')^3) ...
               );
    delta_1f = - 2*pi/lambda * sin_func(y_cur(n1),m1,y_cur(n2),m2) * ...   
              ( (y_cur(n1) - r_u(2))/norm(r_u - [0,y_cur(n1)].') - (y_cur(n1) - r_w(2))/norm(r_w - [0,y_cur(n1)].') ) ;

    f_yn1_s =  cos_func(y_cur(n1),m1,y_cur(n2),m2);

    a_n1m1n2m2 =  delta_2f / 2;
    b_n1m1n2m2 =  y_cur(n1) - delta_1f / delta_2f;
    c_n1m1n2m2 =  f_yn1_s - delta_1f^2 / 2 / delta_2f;



        [tilde_f_n1, y_n1_opt] = calculate_surrogate_function_and_optimal_position(n1, t_sub_current);
    % 更新 t_sub
    if isempty(t_sub_current)
        t_sub_current = zeros(N, 1); % 假设有 N 个天线
    end
    t_sub_current(n1) = y_n1_opt;
